// 构造器模式

function Car(model, year, miles) {
    this.model = model;
    this.year = year;
    this.miles = miles;
}

// 在原型上定义函数，避免每一个对象都重复定义方法
Car.prototype.toString = function() {
    return 'model:' + this.model + ', year:' + this.year + ', miles:' + this.miles;
}

var mondeo = new Car('Ford Mondeo', '2010', 5000);
var civic = new Car('Honda Civic', '2009', 2000);

console.log(mondeo.toString());
console.log(civic.toString());
console.log(mondeo.toString === civic.toString);